package com.mxf.code.product_coupon.strategy.impl;

import com.mxf.code.product_coupon.domain.Member;
import com.mxf.code.product_coupon.domain.Product;
import com.mxf.code.product_coupon.enums.MemberDiscountEnum;
import com.mxf.code.product_coupon.strategy.DiscountStrategy;

import java.math.BigDecimal;

/**
 * 会员折扣策略
 *
 * @author 28382
 */
public class MemberDiscountStrategy implements DiscountStrategy {

    @Override
    public BigDecimal calculateDiscountPrice(Product product, Member member) {
        return product.getPrice().multiply(MemberDiscountEnum.getDiscountByLevel(member.getLevel()));
    }
}
